{extend name="public/base" /}
{block name="title"}修改用户{/block}
{block name="css"}
<link href="__PUBLIC__/static/inspinia/css/plugins/chosen/chosen.css" rel="stylesheet">
{/block}
{block name="main"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>修改用户</h5>
                <div class="ibox-tools">
                    <a class="collapse-link">
                        <i class="fa fa-chevron-up"></i>
                    </a>
                    <a class="close-link">
                        <i class="fa fa-times"></i>
                    </a>
                </div>
            </div>
            <div class="ibox-content">
                <form class="form-horizontal ajax-form" action="{:url('User/editUser')}" method="post">
                    <div class="form-group">
                        <label class="col-lg-2 control-label">用户分组</label>
                        <div class="col-lg-10">
                            <select name="group_ids[]" tabindex="4" required="" placeholder="选择分类" class="form-control chosen-select form-control chosen-select-deselect chosen-select-no-single chosen-select-no-results chosen-select-search" multiple style="width:100%!important;">
                                {volist name="groups" id="vo"}
                                <option value="{$vo.id}" {in name="vo.id" value="$userGroups" }selected{/in} > {$vo.title}
                                {/volist}
                            </select>
                            <span class="help-block m-b-none">普通用户可以不选分组</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">昵称</label>
                        <div class="col-lg-10"><input type="text" name="nickname" placeholder="昵称" class="form-control" value="{$user.nickname|default=''}" autocomplete="off"> <span class="help-block m-b-none"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">邮箱</label>
                        <div class="col-lg-10"><input type="email" name="email" placeholder="邮箱" class="form-control" value="{$user.email|default=''}"> <span class="help-block m-b-none"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">手机号</label>
                        <div class="col-lg-10"><input type="number" name="mobile" placeholder="手机号" pattern="^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$" class="form-control"  value="{$user.mobile|default=''}" autocomplete="off"> <span class="help-block m-b-none"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">QQ号</label>
                        <div class="col-lg-10"><input type="number" name="qq" placeholder="QQ号" pattern="^[1-9][0-9]{4,}$" class="form-control" value="{$user.qq|default=''}" autocomplete="off"> <span class="help-block m-b-none"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">微信号</label>
                        <div class="col-lg-10"><input type="number" name="weixin" placeholder="微信号" class="form-control" value="{$user.weixin|default=''}" autocomplete="off"> <span class="help-block m-b-none"></span>
                        </div>
                    </div>
                    <input type="hidden" name="uid" value="{$user.id|default=0}">
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-10">
                            <button class="btn btn-sm btn-white" type="submit">提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}


{block name="js"}
<!-- Chosen -->
<script src="__PUBLIC__/static/inspinia/js/plugins/chosen/chosen.jquery.js"></script>

<script>
    var config = {
        '.chosen-select': {},
        '.chosen-select-deselect': {allow_single_deselect: true},
        '.chosen-select-search': {search_contains: true},
        '.chosen-select-no-single': {disable_search_threshold: 10},
        '.chosen-select-no-results': {no_results_text: '没有匹配的选项'},
        '.chosen-select-width': {width: "100%!important"}
    }
    for (var selector in config) {
        $(selector).chosen(config[selector]);
    }
</script>
{/block}